﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

using FluentValidation;

using ERPStore.Validators;

namespace ERPStore.ModelValidators
{
    public class ContactInfoValidator : AbstractValidator<Models.ContactInfo>
    {
        public ContactInfoValidator()
        {
            RuleFor(m => m.FullName)
				.NotNullOrTrimmedEmpty()
				.WithMessage("Vous devez indiquer votre nom");

            RuleFor(m => m.Message)
				.NotNullOrTrimmedEmpty()
				.WithMessage("Vous devez indiquer un message");

            RuleFor(m => m.Email)
				.EmailAddress()
				.WithMessage("Adresse email invalide");

            RuleFor(m => m.Email)
				.NotEmpty()
				.WithMessage("L'adresse email doit etre indiquée");

			RuleFor(m => m.PhoneNumber)
				.PhoneNumber(ERPStore.GlobalConfiguration.Configuration.Settings.Country)
				.WithMessage("Numéro de téléphone invalide");

			RuleFor(m => m.PhoneNumber)
				.NotNullOrTrimmedEmpty()
				.WithMessage("Vous devez indiquer un numéro de téléphone");
		}
    }
}
